import { SET_LIST } from './action'
export interface IListItem {
	key: string
	id: string
	title: string
	url: string
	tel: string
	name: string
	[propName: string]: any
}

export interface IState {
	list: IListItem[]
}

export interface IAction {
	type: string
	payload: any
}

const initState: IState = {
	list: []
}

const reducer = (state = initState, action: IAction) => {
	switch (action.type) {
		case SET_LIST:
			return {
				...state,
				list: action.payload
			}
		default:
			return state
	}
}

export default reducer